package com.haizhi.crm.api.controller.share;

import com.haizhi.crm.biz.model.UserShareQo;
import com.haizhi.crm.biz.service.UserShareService;
import com.haizhi.crm.common.model.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Created by yangyijun on 2018/6/1.
 */
@Api(description = "[业务-用户分享]-公用接口" )
@RestController
@RequestMapping("/userShare" )
public class UserShareController {
    @Autowired
    private UserShareService userShareService;

    @ApiOperation(value = "公用-分享", notes = "适用于客户、行内动态、行外事件、产品、拜访记录；保存信息到mysql库tb_user_share表。 entityType：实体对应的表名" )
    @PostMapping("" )
    public Response favourite(@RequestBody @Valid UserShareQo userShareQo) {
        return userShareService.share(userShareQo);
    }

    @ApiOperation(value = "公用-获取分享的对象列表", notes = "适用于客户、行内动态、行外事件、产品、拜访记录；" )
    @GetMapping("findShareTargets" )
    public Response findShareTargets(String name) {
        return userShareService.findShareTargets(name);
    }


}
